//
//  ViewController.swift
//  feiyu444
//
//  Created by hanweiguang on 2018/9/28.
//  Copyright © 2018年 hanweiguang. All rights reserved.
//

import UIKit

class IndexController: BaseVC {


    var addText:UILabel!
    var addImage:UIImageView!

    var listText:UILabel!
    var listImage:UIImageView!



    override func viewDidLoad() {
         self.view.backgroundColor =  UIColor.color(hexString: "#ffffff",alpha:1)

        title="工作台"

        let   backB = UIButton.init()
        backB.setImage(UIImage.init(named:"ss"), for: UIControl.State.normal)

        let backItem = UIBarButtonItem.init(customView: backB)
        self.navigationItem.leftBarButtonItem = backItem

        createCloseApp()

        self.addText = UILabel()
        self.listText = UILabel()
//
        self.addImage=UIImageView()
        self.addImage.image=UIImage(named: "ic_work_tab01")




        self.listImage=UIImageView()
        self.listImage.image=UIImage(named: "ic_work_tab02")

        self.addText.text="添加网点"
        self.listText.text="网点列表"

        self.view.addSubview(self.addText)
        self.view.addSubview(self.listText)

        self.view.addSubview(self.addImage)
        self.view.addSubview(self.listImage)

        self.addImage.snp.makeConstraints{
            (make) in
            make.centerX.equalTo(self.view.center.x)
            make.centerY.equalTo(self.view.center.y-100)
            make.height.equalTo(100)
            make.width.equalTo(100)
        }



        self.addImage.isUserInteractionEnabled = true
        let tapAdd = UITapGestureRecognizer(target:self, action:#selector(addMerchantClick))
        self.addImage.addGestureRecognizer(tapAdd)


        self.listImage.snp.makeConstraints { (make) in
            make.centerX.equalTo(self.view.center.x)
            make.centerY.equalTo(self.view.center.y+50)
            make.height.equalTo(100)
            make.width.equalTo(100)
        }



        self.addText.snp.makeConstraints{ (make)-> Void in
            make.centerY.equalTo(self.view.center.y-30)
            make.centerX.equalTo(self.view.center.x)
        }



        self.listText.snp.makeConstraints{ (make)-> Void in
            make.centerY.equalTo(self.view.center.y+130)
            make.centerX.equalTo(self.view.center.x)
        }



        self.listImage.isUserInteractionEnabled = true
        let tap = UITapGestureRecognizer(target:self, action:#selector(tapHandler))
        self.listImage.addGestureRecognizer(tap)
    }
    @objc func tapHandler() {






       let vc = MerchantsListController()
       self.navigationController?.pushViewController(vc, animated: true)

    }

    @objc func addMerchantClick() {


        let vc = MerchantsAddViewController()
        self.navigationController?.pushViewController(vc, animated: true)


    }

}
